package com.mabang.medata.client;

import java.rmi.RemoteException;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

//import com.sinosoft.application.common.InstonyMd5Encrypt;




import com.mabang.medata.util.XmlUtil;

import java.security.*;

public class CallGuangDong {
	static char[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };

    public String testDB1() {

        String url = "http://210.21.127.254:9081/medata-server/ws/getquoteno";
        String result = "";
        Service service = new Service();
        Call call;
        Object[] object = new Object[1];
        object[0] = getMSG();//Object是用来存储方法的参数


        try {
            call = (Call) service.createCall();
            call.setTargetEndpointAddress(url);// 远程调用路径 

            call.setOperationName(new QName("http://service.medata.mabang.com/","getquoteno"));// 调用的方法名

            call.addParameter("quote",// 设置参数名:                
                    XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);
            result = (String) call.invoke(object);
        } catch (Exception e) {
            e.printStackTrace();
        }
    	 return result;


       
    }

    public String killBlank(String sStr) {
        sStr = sStr.replaceAll("\r\n", "");
        sStr = sStr.replaceAll("	", "");
        return sStr.replaceAll(" ", "");
    }

    public static String getMSG() {
        String ret = "";
        //ret += "<?xml version=\"1.0\" encoding=\"GBK\"?>";
        ret += "<proposal valid=\"false\">";
        ret += "<quote-no>B-001001-201504070199</quote-no>";
        ret += "</proposal>";
       
//        ret += "<proposal valid=\"true\">";
//        ret += "<bill-no>00000</bill-no>";
//        ret += "<quote-no>100001</quote-no>";
//        ret += "</proposal>";
        
              
        return ret;
    }

    public static void main(String[] args) {
//    	CallGuangDong t = new CallGuangDong();
//        String result = t.testDB1();
//        System.out.println(result);
    	try {
			XmlUtil xml  = new XmlUtil(CallGuangDong.getMSG());
			System.out.println(xml.getRootElement().attributeValue("valid"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
}

